#include<bits/stdc++.h>
#define ll long long
using namespace std;
map<ll,int>x;
int n,a;
int main()
{
	freopen("color.in","r",stdin);
	freopen("color.out","w",stdout);
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a;
		x[a]=1;
	}
	if(n==x.size())
		cout<<-1;
	else cout<<n-1-x.size();
	fclose(stdin);
	fclose(stdout);
	return 0;
}
